package com.lc.weekly.lc426.q1;

public class Main {
	
	public static void main(String[] args) {
		int r = new Solution().smallestNumber(5);
		System.out.println(r);
	}

}

class Solution1 {
    public int smallestNumber(int n) {
        int res = 1;
        while(res < n) {
        	res <<= 1;
        	res += 1;
        }
        return res;
    }
}

class Solution {
    public int smallestNumber(int n) {
        int len = Integer.toBinaryString(n).length();
        
        return (1 << len) - 1;
    }
}
